# coding=utf-8

import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")
name = '*'
passwd = '*'
driver.get('https://mail.163.com/')
# 将窗口调整最大
driver.maximize_window()
# 休息5s
time.sleep(5)
current_window_1 = driver.current_window_handle
print(current_window_1)
button = driver.find_element_by_id('lbNormal')
button.click()
driver.switch_to.frame(driver.find_element_by_xpath(
    "//iframe[starts-with(@id, 'x-URS-iframe')]"))
email = driver.find_element_by_name('email')
#email = driver.find_element_by_xpath('//input[@name="email"]')
email.send_keys(name)
password = driver.find_element_by_name('password')
#password = driver.find_element_by_xpath("//input[@name='password']")
password.send_keys(passwd)
submit = driver.find_element_by_id("dologin")
time.sleep(15)
submit.click()
time.sleep(10)
print(driver.page_source)
driver.quit()

